package com.example.gitstudy.config.controller;

import com.example.gitstudy.config.ResponseResult;
import com.example.gitstudy.config.entity.User;
import com.example.gitstudy.config.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author hwj
 * @date 2023/1/12 11:04
 * @描述；
 */
@RestController
@RequestMapping("user")
public class LoginController {

    @Autowired
    private LoginService loginService;


    @PostMapping("login")
    public ResponseResult login(@RequestBody User user,HttpServletResponse response, HttpServletRequest request){
        return loginService.login(user,response,request);
    }

    @PostMapping("logOut")
    public ResponseResult logOut(){
        return loginService.logOut();
    }


}
